using System;
using System.Collections.Generic;
using System.Text;
using Sandia.MVCFramework.View;

namespace Sandia.MVCFramework.Request
{
    /// <summary>
    /// Simple delegate for a method to create a view
    /// </summary>
    /// <returns></returns>
    public delegate IView ViewConstructor();


    /// <summary>
    /// Create a request to add a view to the view manager
    /// </summary>
    /// <remarks>
    /// We want all GUI objects to be created on the GUI thread.  But this request can come from
    /// any number of different threads.  So rather than pass in a view, we pass in a delegate
    /// that can be called to create a view.  The ViewManager (or whatever processes this request)
    /// has the responsibility to make sure that its requests are being process on the GUI thread.
    /// Then this delegate is called by that thread and the view is appropriately created.
    /// </remarks>
    public class AddViewRequest: OneParameterRequest<ViewConstructor>
    {

        /// <summary>
        /// Create a new request to add a view.
        /// </summary>
        /// <param name="ViewConstructor"></param>
        public AddViewRequest(ViewConstructor ViewConstructor) : base(ViewConstructor) { }

        /// <summary>
        /// Get a delegate that knows how to create a new view.
        /// </summary>
        public ViewConstructor ViewConstructor
        {
            get { return this.Param1; }
        }
    }
}
